<?php
/** @var $this yii\web\View */
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\JqueryAsset;

/** @var $goods backend\models\Goods */
$this->registerCssFile('/style/cart.css');
$this->registerJsFile('/js/cart1.js',['depends'=>JqueryAsset::className()]);


?>

<!-- 页面头部 start -->
<div class="header w990 bc mt15">
    <div class="logo w990">
        <h2 class="fl"><a href="<?=Url::home()?>"><img src="/images/logo.png" alt="京西商城"></a></h2>
        <div class="flow fr">
            <ul>
                <li class="cur">1.我的购物车</li>
                <li>2.填写核对订单信息</li>
                <li>3.成功提交订单</li>
            </ul>
        </div>
    </div>
</div>
<!-- 页面头部 end -->

<div style="clear:both;"></div>

<!-- 主体部分 start -->
<div class="mycart w990 mt10 bc">
    <h2><span>我的购物车</span></h2>
    <table>
        <thead>
        <tr>
            <th class="col1">商品名称</th>
            <th class="col3">单价</th>
            <th class="col4">数量</th>
            <th class="col5">小计</th>
            <th class="col6">操作</th>
        </tr>
        </thead>
        <tbody>

        <?php foreach($goods as $onegoods):?>
            <?php
            $logoUrl = Html::img($onegoods->logoUrl());
            $linkUrl = Url::to(['shop/goods','goods_id'=>$onegoods->id,'goods_category_id'=>0]);
            $delLink = Url::to(['shop/del-cart','goods_id'=>$onegoods->id]);
            ?>
        <tr data-goods-id="<?=$onegoods->id?>">
            <td class="col1"><a href="<?=$linkUrl?>"><?=$logoUrl?></a>  <strong><a href="<?=$linkUrl?>"><?=$onegoods->name?></a></strong></td>
            <td class="col3">￥<span><?=$onegoods->shop_price?></span></td>
            <td class="col4">
                <a href="javascript:;" class="reduce_num"></a>
                <input type="text" name="amount" value="<?=$onegoods->amount?>" class="amount"/>
                <input type="hidden" name="csrftoken" class="csrftoken" value="<?=Yii::$app->request->csrfToken?>" />
                <a href="javascript:;" class="add_num"></a>
            </td>
            <td class="col5">￥<span><?=$onegoods->total?></span></td>
            <td class="col6"><a href="javascript:;" class="delOneGoods">删除</a></td>
        </tr>
        <?php endforeach;?>

        </tbody>
        <tfoot>
        <tr>
            <td colspan="6">购物金额总计： <strong>￥ <span id="total"><?=$total?></span></strong></td>
        </tr>
        </tfoot>
    </table>
    <div class="cart_btn w990 bc mt10">
        <a href="<?=Url::home()?>" class="continue">继续购物</a>
        <a href="<?=Url::to(['order/add-order'])?>" class="checkout">结 算</a>
    </div>
</div>
<!-- 主体部分 end -->

<div style="clear:both;"></div>
<!-- 底部版权 start -->

